package com.membership.cloud.web;

import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;

/**
 * Created by hiephn on 2014/07/23.
 */
@Configuration
@ConditionalOnWebApplication
public class WebConfig implements EnvironmentAware {

    private Environment environment;

    @Override
    public void setEnvironment(Environment environment) {
        this.environment = environment;
    }

    @Bean
    public PropertyResolver mcsPropertyResolver() {
        return new RelaxedPropertyResolver(environment, "mcs.");
    }
}
